<template>
	<view class="content">
		<navbar title='我的团队' backgroundColor="#52443B" backColor="#fff">
		</navbar>
		<view class="content">
			<view class="tone">
				<view class="tleft">
					<text class="jl">奖励余额</text>
					<text class="jlnum">{{ info.jiang||0 }}</text>
				</view>
				<view class="tixian" v-if="is_shenhe==0" @click="gettixian">提现</view>
			</view>
			<view class="ttwo">
				<view class="tworow" @click="gettuanlist">
					<text class="tname">我的团队</text>
					<view class="twright">
						<text class="ren"> {{info.team_nums||0}} 人</text>
						<image class="icon_right" src="@/pages_client/static/img/comm_icon_next.png" mode="" />
					</view>
				</view>
			</view>
			<view class="ttwo">
				<text class="biaoti">团队业绩</text>
				<view class="tworow">
					<view class="yeitem">
						<text class="yenum">{{ info.order_money||0 }}</text>
						<text class="yename">订单金额</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.order_nums||0 }}</text>
						<text class="yename">订单数量</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.goods_sale||0 }}</text>
						<text class="yename">商品销量</text>
					</view>
					<!-- <view class="yeitem">
						<text class="yenum">{{ info.zhigou_order_nums||0 }}</text>
						<text class="yename">直购订单数</text>
					</view> -->
				</view>
			</view>
			<view class="ttwo" style="padding: 30rpx 0;">
				<text class="biaoti">提成金额</text>
				<view class="tworow">
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_today||0 }}</text>
						<text class="yename">今日</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_yesterday||0 }}</text>
						<text class="yename">昨日</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_week||0 }}</text>
						<text class="yename">本周</text>
					</view>
				</view>
				<view class="tworow threeitem">
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_month||0 }}</text>
						<text class="yename">本月累计奖励</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_no||0 }}</text>
						<text class="yename">当前未结算</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{ info.tc_money_yes||0 }}</text>
						<text class="yename">已结算</text>
					</view>
				</view>
				<view class="heng"></view>
				<view class="tiview">
					<text class="biaoti">提成金额</text>
					<!-- <view class="quanbu">
						<text class="quan">全部</text>
						<image class="icon_right" src="@/pages_client/static/img/comm_icon_next.png" mode="" />
					</view> -->
				</view>
				<view class="jieview" v-for="(item,index) in list" :key="index">
					<view class="jieone">
						<text class="jname">{{item.memo}}</text>
						<text class="jia">{{item.money}}元</text>
					</view>
					<view class="jieone">
						<text class="jtime">{{item.createtime}}</text>
						<text class="jtime ml">{{ item.status }}</text>
					</view>
				</view>
				<u-loadmore :status="status" @loadmore="loadmore" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
				is_shenhe:1,////1就是开启审核
			}
		},
		onLoad() {
			this.getshenhe()
			this.gettuan()
			this.getList()
		},
		onShow() {
		},
		methods: {
			async getshenhe(){
				let res = await this.$u.api.getShenhe({
				});
				if(res){
					if(!this.compareVersion(this.$store.state.Version,res.version)){
						//当前版本小于 接口返回版本
						this.is_shenhe = res.is_shenhe//1就是开启审核
						// #ifdef H5
						this.is_shenhe = 0
						//  #endif
					}else{
						//当前版本等于或者大于 接口返回版本 显示
						this.is_shenhe = 0
					}
				}
			},
			async gettuan(){
				let res = await this.$u.api.teamgetData({
				});
				this.info = res
			},
			gettuanlist(){
				this.navrouter("/pages_client/twoPage/MyTeamList");
			},
			gettixian(){
				this.navrouter("/pages_client/twoPage/Tixian?type=2");
			},
			async getList(){//列表数据
				let res = await this.$u.api.getJiangLog({
				  limit:this.limit,
				  page:this.page
				});
					this.last_page = res.lastpage
					let list = res.list;
					this.list = this.page == 1 ? list : [...this.list, ...list];	
					if(res.list==''||Number(list.length)<Number(this.limit)||Number(this.page)>Number(this.last_page)){
						this.status = 'nomore';
					}
				}
				
			},
			loadmore() {
				let page = this.page;
				// let last_page = this.last_page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			getClear(){
				this.list = []
				this.page = 1,
				this.status= "loadmore"
				this.getList()
			}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #52443B;
	}
	.content{
		background: #52443B;
		padding-bottom: 10rpx;
		.tone{
			padding: 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-bottom: 30rpx;
			.tleft{
				display: flex;
				flex-direction: column;
				.jl{
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
				}
				.jlnum{
					font-weight: bold;
					font-size: 50rpx;
					color: #FFFFFF;
					display: block;
					margin-top: 10rpx;
				}
			}
			.tixian{
				margin-left: auto;
				padding: 14rpx 20rpx;
				background: rgba(255,255,255,0.2);
				border-radius: 10rpx;
				border: 1px solid #FFFFFF;
				font-weight: bold;
				font-size: 30rpx;
				color: #FFFFFF;
			}
		}
		.ttwo{
			background: #FFFFFF;
			border-radius: 30rpx;
			padding: 30rpx 30rpx;
			display: flex;
			flex-direction: column;
			margin: 0rpx 30rpx 20rpx;
			.biaoti{
				font-weight: bold;
				font-size: 32rpx;
				color: #111111;
				display: block;
				margin-bottom: 20rpx;
				margin-left: 30rpx;
			}
			.tworow{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 15rpx 0;
				.yeitem{
					border-right: 1rpx solid #eee;
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					.yenum{
						font-weight: bold;
						font-size: 28rpx;
						color: #111111;
					}
					.yename{
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						display: block;
						margin-top: 10rpx;
					}
				}
				.yeitem:last-child{
					border-right: none;

				}
				.tname{
					font-weight: bold;
					font-size: 32rpx;
					color: #111111;
				}
				.twright{
					margin-left: auto;
					display: flex;
					flex-direction: row;
					align-items: center;
					.ren{
						font-weight: bold;
						font-size: 32rpx;
						color: #111111;
					}
					.icon_right{
						margin-left: 11rpx;
						width: 24rpx;
						height: 24rpx;
					}
				}
			}
			.threeitem{
				border-top: 1rpx solid #eee;
			}
			.heng{
				height: 10rpx;
				background: #EEEEEE;
				width: 100%;
				margin: 30rpx 0;
			}
			.tiview{
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-bottom: 20rpx;
				.biaoti{
					margin-bottom: 0rpx;
				}
				.quanbu{
					margin-left: auto;
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-right: 30rpx;
					.quan{
						font-weight: 500;
						font-size: 26rpx;
						color: #666666;
					}
					.icon_right{
						margin-left: 10rpx;
						width: 20rpx;
						height: 20rpx;
					}
				}
			}
			.jieview{
				background: #F5F5F5;
				border-radius: 20rpx;
				display: flex;
				flex-direction: column;
				padding: 30rpx;
				margin: 0 30rpx 20rpx;
				.jieone{
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-bottom: 8rpx;
					.jname{
						font-weight: bold;
						font-size: 28rpx;
						color: #111111;
						max-width: 80%;
						display: inline-block;
					}
					.jia{
						margin-left: auto;
						font-weight: bold;
						font-size: 28rpx;
						color: #111111;
					}
					.jtime{
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
					}
				}
				.jieone:last-child{
					margin-bottom: 0;
				}
			}
		}
	}
</style>
